package industry

import (
	"context"
	"wh-1-backend/internal/dao"
	"wh-1-backend/internal/model/entity"
	"wh-1-backend/internal/service"
)

type sIndustry struct {
}

func New() *sIndustry {
	return &sIndustry{}
}

func init() {
	service.RegisterIndustry(New())
}

func (i *sIndustry) ListByPid(ctx context.Context) (res []*entity.Industry, err error) {
	err = dao.Industry.Ctx(ctx).Scan(&res)
	return
}

func (i *sIndustry) ListByIds(ctx context.Context, ids []uint) (res []*entity.Industry, err error) {
	err = dao.Industry.Ctx(ctx).WhereIn(dao.Industry.Columns().Id, ids).Scan(&res)
	return
}
